const welcome = {
    name:'Welcome',
    template: `<div class="bodypd wh100 ovy">
        <div class='swiper w100 h160' id="swiper">
            <el-carousel 
                trigger="click" 
                height="158px"
                autoplay="false"
                >
                <el-carousel-item v-for="(v,k) in banner" :key="k">
                    <a :href="hrefA+v.txet"><img class="wh100" :src='v.img'></a>
                </el-carousel-item>
            </el-carousel>
        </div>
        <div class="h30"></div>
        <div name="nav" class="w100 h60 flex jusa">
            <template v-for="(v,k) in column" :key="k">
                <a  id="navbar" :href="hrefA+v.txet">
                    <img :src="v.avatar" class="w60 h100 lrm  br15">
                    <div  class="ffh fs16 textc c07"  v-text="v.name"></div>
                </a>
            </template>
        </div>
        <div class="h20"></div><!--占位-->
        <div class="mart15 w100 h2 bgco3 br2"></div>
        <div class="h30"></div>
        <div class="w100">
            <div v-for="(v,k) in top">
                <div class="h30" v-if="k!=0"></div>
                <div class="flex jusb">
                    <div class="w170 pdlr15">
                        <div class="h185 bgce pd05 br10 pr">
                            <div class="h160 ofh lh20">
                                <div class="fs13 fsw9 sp1 pd1003 bbx c07" v-text="v.name"></div>
                                <div class="fs13  sp2 c666" v-text="v.description"></div>
                            </div>
                            <div class="h25"><a class="fs15 sp1 c999 tsx8 pa r0 b2" :href="hrefA+'/dordinary?id='+v.id">查看详情>>></a></div>
                        </div>
                    </div>
                    <div class="w170 pdlr15">
                        <div class="h185 bgce br10 ovh pr">
                            <div class="h95  bbx">
                                <img :src="v.avatar" class="wh100  bbx">
                            </div>
                            <div class="h5"></div>
                            <div class="fs13 fsw9 sp1 pd1003 bbx  c07" v-text="v.name"></div>
                            <a class="fs15 sp1 c999 tsx8 pa r0 b2" :href="hrefA+'/dordinary?id='+v.id">查看详情>>></a>
                            <div class="h20"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="mrtb30 bgce">
            <div class="pdtitle1 brlr5 bbx fs18 cfff sp2 fsw1">最新消息</div>
            <div class="h15"></div>
            <div class="w100">
                <template v-for="(v,k) in news">
                    <a  class="flex pd10" :href="hrefA+'/dordinary?id='+v.id">
                        <img :src="v.avatar" class="w22 h22 br5 ">
                        <div class="disi sp1 fsw1 c666 pdl10 fs13 lh22" v-text="v.name"></div>
                    </a>
                </template>
            </div>
        </div>
        <div class="w100">
            <div v-for="(v,k) in list">
                <div class="h30" v-if="k!=0"></div>
                <div class="flex jusb">
                    <div class="w170 pdlr15">
                        <div class="h185 bgce pd05 br10 pr">
                            <div class="h160 ofh lh20">
                                <div class="fs13 fsw9 sp1 pd1003 bbx c07" v-text="v.name"></div>
                                <div class="fs13  sp2 c666" v-text="v.description"></div>
                            </div>
                            <div class="h25"><a class="fs15 sp1 c999 tsx8 pa r0 b2" :href="hrefA+'/dordinary?id='+v.id">查看详情>>></a></div>
                            <!--<div class="fs13 fsw9 sp1 pd1003 bbx" v-text="v.name"></div>
                            <div class="fs13 slh7 sp2 c666" v-text="v.description"></div>
                            <div class="h10"></div>
                            <a class="fs15 sp1 c999 tsx8 pa r0 b2" :href="hrefA+'/dordinary?id='+v.id">查看详情>>></a>
                            <div class="h20"></div>-->
                        </div>
                    </div>
                    <div class="w170 pdlr15">
                        <div class="h185 bgce br10 ovh pr">
                            <div class="h95 bbx">
                                <img :src="v.avatar" class="wh100   bbx">
                            </div>
                            <div class="h5"></div>
                            <div class="fs13 fsw9 sp1 pd1003 bbx c07" v-text="v.name"></div>
                            <a class="fs15 sp1 c999 tsx8 pa r0 b2" :href="hrefA+'/dordinary?id='+v.id">查看详情>>></a>
                            <div class="h20"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="h20"></div>
    </div>`,
    data: function () { return{
        banner:[],
        column:[],
        top:[],
        news:[],
        list:[],
        hrefA:hrefA,
        // num:''
    } },
    created() {
        let v= this
        // v.num=Date.now()
        v.getToken()
        v.getList()
    },
    methods: {
        getList(){
            let v= this
            let uri = '/api/article/index'
            ajax({url:uri,method:'get'}).then((r)=>{
                if(r.code == 200){
                    // console.log('r.data',r.data);
                    
                    v.banner = r.data.banner
                    v.column = r.data.column
                    v.top = r.data.top
                    v.news = r.data.news
                    v.list = r.data.list


                }
            }).catch((e)=>{
                console.log('catch',e);
            })
        }
        ,
        getToken(){
            let v=this
            console.log('locationsearch',location.search);
            let str = location.search.substr(1)
            let arr = str.split("&")
            let arr1 = arr[0].split("=")
            console.log('token',arr1[1]);

            if (arr1[1] && !localStorage.token) localStorage.setItem('token',arr1[1])
        }
    },
}
export default welcome